import historyFallback from 'connect-history-api-fallback'
export default function createVitePluginHistory(options: any) {
  return {
    name: 'vite-plugin-history',
    enforce: 'pre',
    config() {
      return {
        appType: 'mpa',
      };
    },
    configureServer(server: any) {
      server.middlewares.use(
        historyFallback({
          verbose: Boolean(process.env.DEBUG) && process.env.DEBUG !== 'false',
          disableDotRule: undefined,
          htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
          ...options,
        })
      );
    },
  };
};

